{include file="public/header" /}
<link rel="stylesheet" href="__ORG__/validform/css/validform.css">
<script type="text/javascript" src="__ORG__/validform/js/Validform_v5.3.2_min.js"></script>
<!--面包屑导航 开始-->
<div class="crumb_warp">
    <!--<i class="fa fa-bell"></i> 欢迎使用登陆网站后台，建站的首选工具。-->
    <i class="fa fa-home"></i> <a href="{:url('admin/index/info')}">首页</a> &raquo; <a href="{:url('admin/config/index')}">配置管理</a> &raquo; 添加配置
</div>
<!--面包屑导航 结束-->

<!--结果集标题与导航组件 开始-->
<div class="result_wrap">
    <div class="result_title">
        <h3>配置管理操作</h3>
        {if isset($error)}
        <div class="mark">
            <p>{$error}</p>
        </div>
        {/if}
    </div>
    <div class="result_content">
        <div class="short_wrap">
            <a href="{:url('admin/config/add')}"><i class="fa fa-plus"></i>添加配置</a>
            <a href="{:url('admin/config/index')}"><i class="fa fa-recycle"></i>配置列表</a>
        </div>
    </div>
</div>
<!--结果集标题与导航组件 结束-->

<div class="result_wrap">
    <form action="" method="post" class="demoform">
        <table class="add_tab">
            <tbody>
            <tr>
                <th><i class="require">*</i>配置中文名称：</th>
                <td>
                    <input type="hidden" name="_token" value="6HbJH1awbyllKKTS0QPEMU8j4WFPjKPZuEzrnJOh">
                    <input type="text" size="30" placeholder="名称" name="zh_name" class="inputxt" value="{$data.zh_name}">
                    <span><i class="fa fa-exclamation-circle yellow"></i>这里必须输入内容</span>
                </td>
            </tr>
            <tr>
                <th><i class="require">*</i>英文名称：</th>
                <td>
                    <input type="text" size="30" placeholder="name" name="en_name" class="inputxt" value="{$data.en_name}">
                    <span><i class="fa fa-exclamation-circle yellow"></i>这里必须输入内容</span>
                </td>
            </tr>
            <tr>
                <th><i class="require">*</i>类型：</th>
                <td>
                    <select name="field_type" id="select_type" onchange="showTr()">
                        <option value="input" {if  $data.field_type == 'input'}selected{/if}>input</option>
                        <option value="textarea" {if  $data.field_type == 'textarea'}selected{/if}>textarea</option>
                        <option value="radio" {if  $data.field_type == 'radio'}selected{/if}>radio</option>
                    </select>
                </td>
            </tr>
            <tr id="content">
                <th>内容：</th>
                <td>
                    <input type="text" size="50" name="field_value" value="{$data.field_value}">
                    <span><i class="fa fa-exclamation-circle yellow"></i>只有类型为radio需要输入内容,(例：1|开启,0|关闭 )</span>
                </td>
            </tr>
            <tr>
                <th>描述：</th>
                <td>
                    <textarea name="tips" id="" cols="30" rows="10"></textarea>
                </td>
            </tr>

            <tr>
                <th></th>
                <td>
                    <input type="hidden" name="id" value="{$data.id}">
                    <input type="submit" value="提交">
                    <input type="button" class="back" onclick="history.go(-1)" value="返回">
                </td>
            </tr>
            </tbody>
        </table>
    </form>
</div>

<script type="text/javascript">
    //$(".demoform").Validform();
    showTr();
    function showTr() {
        var type = $('#select_type').val();
        if(type == 'radio') {
            $('#content').show();
        }else {
            $('#content').hide();
        }
    }

    var demo=$(".demoform").Validform({
        tiptype:3,
        label:".label",
        showAllError:true,
        datatype:{
            "zh1-6":/^[\u4E00-\u9FA5\uf900-\ufa2d]{1,6}$/
        },
        ajaxPost:false
    });

    //通过$.Tipmsg扩展默认提示信息;
    //$.Tipmsg.w["zh1-6"]="请输入1到6个中文字符！";
    demo.tipmsg.w["zh1-6"]="请输入1到6个中文字符！";
    demo.tipmsg.w["*2-30"]="名称请输入2到30个字符！";

    demo.addRule([{
        ele:".inputxt:eq(0)",
        datatype:"*2-30"
    },
        {
            ele:".inputxt:eq(1)",
            datatype:"*2-30"
        },
        {
            ele:"select",
            datatype:"*"
        }]);

</script>

{include file="public/footer" /}